{extend name="admin@index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">字段列表</div>
    <div class="layui-card-body">
        <table class="layui-hide" id="currentTable" lay-filter="currentTable"></table>
    </div>
</div>
<script type="text/html" id="barTool">
    {{#  if(!d.iffixed){ }}
    <a data-open='{:url("edit")}?id={{ d.id }}' class="layui-btn layui-btn-xs" title="编辑"><i class='iconfont icon-brush_fill'></i></a>
    <a href='{:url("del")}?id={{ d.id }}' class="layui-btn layui-btn-danger layui-btn-xs layui-tr-del"><i class='iconfont icon-trash_fill'></i></a>
    {{#  } }}
</script>
{/block}
{block name="script"}
<script>
layui.use('yznTable', function() {
    var table = layui.yznTable;

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTable',
        add_url: "{:url('add',['id'=>$id])}",
        modify_url: '{:url("multi")}',
    };

    table.render({
        init: init,
        toolbar: ['refresh',
            [{
                html: '<a class="layui-btn layui-btn-sm" type="button" href="{:url("admin/formguide.formguide/index")}"><i class="iconfont icon-undo"></i>&nbsp;返回</a>'
            }], 'add',
        ],
        url: '{:url("index",["id"=>$id])}',
        cols: [
            [
                { field: 'listorder', width: 60, title: '排序', edit: 'text' },
                { field: 'id', width: 60, title: 'ID' },
                { field: 'name',title: '字段名称' },
                { field: 'title', title: '标题' },
                { field: 'type', width: 120, title: '字段类型' },
                { field: 'create_time', width: 180, title: '创建时间', search: 'range' },
                { field: 'ifrequire', width: 60,title: '必填',templet: yznTable.formatter.label,selectList:{0:'否',1:'是'}},
                { field: 'status', width: 80,title: '状态',templet: yznTable.formatter.label,selectList:{0:'禁用',1:'启用'}},
                { fixed: 'right', width: 90, title: '操作', templet: '#barTool' }
            ]
        ],
        page: {}
    });

});
</script>
{/block}